package com.atguigu.crowd.handler;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.atguigu.crowd.api.MySQLRemoteService;
import com.atguigu.crowd.constant.CrowdConstant;
import com.atguigu.crowd.entity.vo.PortalTypeVO;
import com.atguigu.crowd.util.ResultEntity;

@Controller
public class PortalHandler {
	@Autowired
	private MySQLRemoteService ms;
	
	@RequestMapping("/")
	public String showPortalPage(Model model) {
// 这里实际开发中需要加载数据……
		   ResultEntity<List<PortalTypeVO>> resultEntity = ms.getPortalTypeProjectDataRemote();
	        String result = resultEntity.getResult();
	        if (ResultEntity.SUCCESS.equals(result)){
	            List<PortalTypeVO> list = resultEntity.getData();
	                model.addAttribute(CrowdConstant.ATTR_NAME_PORTAL_DATDA,list);
	        }
		return "portal";
	}
}
